/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package calcu.url;

/**
 *
 * @author pblinux
 */
public class Trigonometricas extends AbstractOperador{
    
    @Override
    public float operar(float op1, float op2) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
    
    public float operar(float op1, char operador) {
        float resultado = 0;
        if(operador == 'c'){
            resultado = (float) Math.cos(op1);
        }
        if(operador == 's'){
            resultado = (float) Math.sin(op1);
        }
        if(operador == 't'){
            resultado = (float) Math.tan(op1);
        }
        if(operador=='h'){
           resultado=(float) ConvertRadiansToDegred(op1, operador);
        }
        return resultado;
    }
    
   public float ConvertRadiansToDegred(float op1,char c){
    float rest = 0;
       if(c=='g'){ //conversion de radianes a grados
           rest=(float) ((op1*180)/Math.PI);
       }else
           if(c=='r'){
               rest= (float) ((op1*Math.PI)/180);
           }
       return rest;
   }
    
    

    
    
    
    
}
